<!DOCTYPE html>
<html>

<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>景区失物招领管理系统</title>
    <meta name="description" content="景区失物招领管理系统">
    <meta name="keywords" content="景区失物招领管理系统">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="./plugins/elementui/index.css">
    <link rel="stylesheet" href="./plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="./css/style.css">
    <style type="text/css">
        .el-main {
            position: absolute;
            top: 70px;
            bottom: 0px;
            left: 200px;
            right: 10px;
            padding: 0;
        }
    </style>
</head>

<body class="hold-transition skin-purple sidebar-mini">
    <div id="app">
        <el-container>
            <el-header class="main-header" style="height:70px;">
                <nav class="navbar navbar-static-top" :class=''>
                    <!-- Logo -->
                    <a href="#" class="logo" style="text-align:center">
                        <span class="logo-lg" style="font-size: 24px; color: #000;">家政管理系统</span>
                    </a>
                    <div class="right-menu">
                        <span class="help"><a href="./index.html">用户端</a></span>
                        <el-dropdown class="avatar-container right-menu-item" trigger="click">
                            <div class="avatar-wrapper">
                                <!-- <img src="../img/user2-160x160.jpg" class="user-avatar"> -->
                                {{username}}
                            </div>
                            <el-dropdown-menu slot="dropdown" >
                                <el-dropdown-item divided>
                                    <span style="display:block;"><a style="display:block;"  @click="handleCreate()">修改密码</a></span>
                                </el-dropdown-item>
                                <el-dropdown-item divided>
                                    <a style="display:block;" href="/login.html">退出</a>
                                </el-dropdown-item>
                            </el-dropdown-menu>
                        </el-dropdown>
                    </div>
              
                        <div class="add-form">
                            <el-dialog title="修改密码" :visible.sync="dialogFormVisible">
                                <el-form ref="dataAddForm" :model="formData" label-position="right" label-width="100px">
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="账号" prop="code">
                                                <el-input v-model="formData.userName"></el-input>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item label="旧密码" prop="name">
                                                <el-input v-model="formData.password" />
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                                                            
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="新密码" prop="code">
                                                <el-input v-model="formData.newPassword"></el-input>
                                            </el-form-item>
                                        </el-col>   
                                        <el-col :span="12">
                                            <el-form-item label="确认密码" prop="code">
                                                <el-input v-model="formData.confirmPassword"></el-input>
                                            </el-form-item>
                                        </el-col>   
                                    </el-row>
                                </el-form>
                                <div slot="footer" class="dialog-footer">
                                    <el-button @click="dialogFormVisible = false">取消</el-button>
                                    <el-button type="primary" @click="handleAdd()">确定</el-button>
                                </div>
                            </el-dialog>
                        </div>
                </nav>
            </el-header>
            <el-container>
                <el-aside width="200px">
                    <el-menu>
                        <el-submenu v-for="menu in menuList" :index="menu.path" :href="menu.linkUrl">
                            <template slot="title">
                                <i class="el-icon-s-home"></i>
                                <a :href="menu.linkUrl" target="right">{{menu.title}}</a>
                            </template>
                            <template v-for="child in menu.children">
                                <el-menu-item :index="child.path">
                                    <a :href="child.linkUrl" target="right">{{child.title}}</a>
                                </el-menu-item>
                            </template>
                        </el-submenu>
                    </el-menu>
                </el-aside>
                <el-container>
                    <iframe name="right" class="el-main" src="main.html" width="100%" height="800px"
                        frameborder="0"></iframe>
                </el-container>
            </el-container>
        </el-container>
    </div>
</body>
<!-- 引入组件库 -->
<script src="./js/vue.js"></script>
<script src="./plugins/elementui/index.js"></script>
<script src="/js/axios-0.18.0.js"></script>
<script type="text/javascript" src="./js/jquery.min.js"></script>
<script>
    new Vue({
        el: '#app',
        data: {
            formData: {},//表单数据
            dialogFormVisible: false,//增加表单是否可见
            menuList: [

                {
                    "path": "1",
                    "title": "首页",
                    "icon": "fa-tty",
                    "linkUrl": "main.html",
                    "children": [
                        {
                            "path": "/1-3",
                            "title": "寻物管理",
                            "linkUrl": "xunwuAdmin.html",
                            "children": []
                        },
                        {
                            "path": "/1-5",
                            "title": "招领管理",
                            "linkUrl": "zhaolingAdmin.html",
                            "children": []
                        },
                    ]
                },
            ],
            username: ''
        },
        methods: {
            // 弹出修改密码窗口
            handleCreate() {
                this.formData = {};
                this.dialogFormVisible = true;
            },
            //修改密码
            handleAdd() {                
                axios.post(`/login/update`, this.formData).then(response => {
                    //隐藏窗口
                    this.dialogFormVisible = false;
                    if (response.data.code == 1) {
                        this.$message({
                            message: response.data.data,
                            type: 'success'
                        });
                    } else {
                        this.dialogFormVisible = false;
                        this.$message.error("预约失败");
                    }

                }).finally(() => {
                    //重新查询数据
                    this.findPage();
                })


            },
            // 重置表单
            resetForm() {
            },
        },
        created() {
            this.username = "admin";
            /*axios.get(`/user/findUsername.do`).then(response => {
                this.username = response.data.username;
            });*/
        }
    });
    $(function () {
        let wd = 200;
        $(".el-main").css('width', $('body').width() - wd + 'px');
    });
</script>


</html>